﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTOSW.Core.Membership.Objects.Model;
using DTOSW.Core.Membership.Objects.ViewData;
using DTOSW.Service.Membership;
using DTOSW.Core.Membership.Security;
using DTOSW.Core.Membership.Extensions;
namespace DTOSW.TestConsole
{
    class Program
    {
       

        static void Main(string[] args)
        {

            MembershipService membership = new MembershipService();

            CreationStatus status = membership.CreateUser("bo", "123456", "Bo@danieltoft.dk");

            Console.WriteLine(status.ToString());
            //membership.CreateUser("Sven", "Sven", "Sven@danieltoft.dk");
            //membership.CreateUser("Poul", "Poul", "Poul@danieltoft.dk");
            //membership.CreateUser("Kirsten", "Kirsten", "Kirsten@danieltoft.dk");

            //User user = membership.GetUser("Bo");

            //membership.DeleteUser(user.UserID);

            User user = membership.GetUserByUserName("popo");

      

            UserViewData hej = new UserViewData();

            hej.Users = membership.GetUsers();
            int i = 0;
            foreach (User bruger in hej.Users)
            {

                Console.WriteLine(bruger.UserName + " Password: " + bruger.Password.UserPassword);

                foreach (Mail mail in bruger.Profile.Mails)
                {
                    Console.WriteLine("\t" + mail.Email);
                }

            }





            //Update User
            //User user = userService.GetUser("linne");

            //Profile profile = new Profile();

            //profile.Address = "Fasanvej 30";
            //profile.City = "Bremdal";
            //profile.UserID = user.UserID;
            //profile.FirstName = "Daniel";
            //profile.LastName = "Toft";
            //profile.PostalCode = 7600;




            //profile.Mails.Add(new Mail {
            //    UserID = user.UserID,
                
            //    Email = "dto@1.dk",
            //    MailType = "Gmail",
            //    PrimaryMail = true,
            //    LoweredEmail = "dto@danieltoft.dk"
            //});

            //profile.Mails.Add(new Mail {
            //    UserID = user.UserID,
            //    MailID = 32,
            //    Email = "support@toftit.com",
            //    LoweredEmail = "support@toftit.com",
            //    MailType = "msn",
            //    PrimaryMail = false
            //});


            //userService.UpdateProfile(profile);


            
        }
        static void CreateUser()
        {
            
        }
        static void UpdateUser()
        {

        }
    }
}
